Skip to content

vfs: add ZipProvider - #64915

Open
pipobscure wants to merge 1 commit into
nodejs:mainfrom
pipobscure:zipvfsprovider
Open

vfs: add ZipProvider#64915
pipobscure wants to merge 1 commit into
nodejs:mainfrom
pipobscure:zipvfsprovider

Conversation

@pipobscure

@pipobscure pipobscure commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Add a node:vfs provider backed by a node:zlib ZIP archive - a ZipBuffer
held in memory or a ZipFile on disk - that exposes the archive's members
as a virtual filesystem tree. Directories are recognized both explicitly
(a "name/" entry) and implicitly (any entry under "name/"), and a file
opened for writing commits its content as a new archive entry when its
handle is closed. The provider is read-only unless the backing archive
is writable, and offers both asynchronous and synchronous operations.
Available as vfs.ZipProvider.

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. vfs Issues and PRs related to the virtual filesystem subsystem. labels Aug 1, 2026
Comment thread lib/internal/vfs/providers/ziparchive.js
@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.93814% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.11%. Comparing base (a844473) to head (2dc89ec).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/vfs/providers/ziparchive.js 97.93% 7 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64915      +/-   ##
==========================================
+ Coverage   90.07%   90.11%   +0.04%     
==========================================
  Files         754      755       +1     
  Lines      256378   257134     +756     
  Branches    48498    48784     +286     
==========================================
+ Hits       230936   231720     +784     
+ Misses      16572    16564       -8     
+ Partials     8870     8850      -20     
Files with missing lines Coverage Δ
lib/vfs.js 100.00% <100.00%> (ø)
lib/internal/vfs/providers/ziparchive.js 97.93% <97.93%> (ø)

... and 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pipobscure

Copy link
Copy Markdown
Contributor Author

Note: the failing mac-os test seems to be a flakiness issue with that test. I've seen it before and it seems to be entirely unrelated.

@pipobscure

pipobscure commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@mcollina given you are the VFS man, this one is for you.

Note:

Next up will be a commandline option --vfs-mount which allows mounting a VFS mount from the CLI for the app to use. This is useful for example to provide an app with an archive of files it can use, like bundled resources. This can be mounted by either mounting a directory (development) or a bundled archive (deployments)

Following on from that is a --vfs-load flag that will set the entrypoint to a vfs mounted volume. In the full combination it's possible to have bundled node apps (zip archives) that get loaded. --vfs-mount already allows registering custom vfs-providers (via --import or -r). So what the vfs-provider does (signed code checking, etc...) is up to the user. In the simplest case, you just have an app as a zip archive and it works out of the box.

I have all the code already and it's working quite nicely.

@mcollina

mcollina commented Aug 1, 2026

Copy link
Copy Markdown
Member

I'm doing significant surgery on the vfs machinery in #63653.

I need to land that before this.

@pipobscure

pipobscure commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

I'm doing significant surgery on the vfs machinery in #63653.

I need to land that before this.

Have a look at my branch pipobscure#8 here which does all the module loader work for VFS already. And I've been testing it like crazy.

Though from what I see in your PR you're going way deeper, especially the fact that you have an O(1) identification of vfs based modules is a much better solution. So I'm EXTREMELY happy to hold on with this and then rework my other PRs based on your stuff 😄 (starting work based of your solution)

Note: It looks like #63653 is entirely orthogonal to this PR as that doesn't alter the Provider surface contract at all. But for sanity sake it's still better to hold this until #63653 is landed and rebase this on that then.

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 2, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 2, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@trivikr trivikr added the blocked PRs that are blocked by other issues or PRs. label Aug 3, 2026
@trivikr

This comment was marked as outdated.

@pipobscure
pipobscure force-pushed the zipvfsprovider branch 3 times, most recently from e68c6c9 to 85c863f Compare August 14, 2026 08:27

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@pipobscure

This comment was marked as outdated.

@pipobscure

This comment was marked as outdated.

@mcollina mcollina added request-ci Add this label to start a Jenkins CI on a PR. and removed blocked PRs that are blocked by other issues or PRs. labels Aug 31, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 31, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Add a node:vfs provider backed by a node:zlib ZIP archive - a ZipBuffer
held in memory or a ZipFile on disk - that exposes the archive's members
as a virtual filesystem tree. Directories are recognized both explicitly
(a "name/" entry) and implicitly (any entry under "name/"), and a file
opened for writing commits its content as a new archive entry when its
handle is closed. The provider is read-only unless the backing archive
is writable, and offers both asynchronous and synchronous operations.
Available as vfs.ZipProvider.

Signed-off-by: Philipp Dunkel <pip@pipobscure.com>
@pipobscure

Copy link
Copy Markdown
Contributor Author

Rebased on main because CI was failing with an unrelated test.

@bakkot

bakkot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

I am excited to use this in combination with the import bytes proposal: you can have an on-disk .zip that you import with import-bytes and load as a VFS, and that will run as-is, and you can also trivially bundle it into a single .js file (with something like esbuild) for distributing.

@pipobscure

pipobscure commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

I am excited to use this in combination with the import bytes proposal: you can have an on-disk .zip that you import with import-bytes and load as a VFS, and that will run as-is, and you can also trivially bundle it into a single .js file (with something like esbuild) for distributing.

Have a look at https://github.com/pipobscure/bundles and https://claude.ai/code/artifact/7860e0a8-3d32-4b9e-b5ce-94a36289bc34?via=auto_preview to get a preview of why I'm doing this stuff and what the plan is 😄

And if you want a node that can do exactly this build https://github.com/pipobscure/node/tree/deploy

@trivikr

trivikr commented Sep 1, 2026

Copy link
Copy Markdown
Member

I apologize for the force push. I was experimenting with ZipProvider in my local workspace, and pushed to pipobscure's fork instead of my fork. It's back to previous state.

@trivikr

trivikr commented Sep 1, 2026

Copy link
Copy Markdown
Member

This needs a re-review as rebase was done 12 hours ago as per #64915 (comment)

@trivikr
trivikr requested a review from mcollina September 1, 2026 04:55
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 1, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 1, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@pipobscure

Copy link
Copy Markdown
Contributor Author

I have no way to view CI, so I can't investgate/validate what is happening with the 3 failures. Given that they fail equally on #64915 and #65680 I am assuming that this might be a pure CI issue and nothing in the PRs. However that's a random guess. Can someone please confirm that intuition? I am happy to fix anything I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. vfs Issues and PRs related to the virtual filesystem subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants